﻿<?xml version="1.0" encoding="utf-8" ?>
<c2eventsheet>
    <!--All the 'name' attributes are ignored by Construct 2 - they are there for readability only.-->
    <name>EventSheetLevel</name>
    <events>
        <event-group description="" title="Mouse Cursor to Hand">
            <sub-events>
                <event-block>
                    <conditions>
                        <condition id="7" name="Cursor is over object" type="Mouse">
                            <param id="0" name="Object">Button</param>
                        </condition>
                    </conditions>
                    <actions>
                        <action id="0" name="Set cursor style" type="Mouse">
                            <param id="0" name="Cursor style">1</param>
                        </action>
                    </actions>
                </event-block>
                <event-block>
                    <conditions>
                        <condition id="-22" name="Else" type="System" />
                    </conditions>
                    <actions>
                        <action id="0" name="Set cursor style" type="Mouse">
                            <param id="0" name="Cursor style">0</param>
                        </action>
                    </actions>
                </event-block>
            </sub-events>
        </event-group>
        <event-group description="" title="Handle Level complete or failure">
            <sub-events>
                <event-block>
                    <conditions>
                        <condition id="-2" name="On start of layout" type="System" />
                    </conditions>
                    <actions />
                    <sub-events>
                        <comment>When the level should end, we are waiting for 2 seconds and invoking the menu screen with Menu, Next and Retry buttons</comment>
                        <event-block>
                            <conditions />
                            <actions>
                                <action id="-16" name="Wait" type="System">
                                    <param id="0" name="Seconds">2</param>
                                </action>
                                <action id="-3" name="Create object" type="System">
                                    <param id="0" name="Object to create">TransparentBackground</param>
                                    <param id="1" name="Layer">&quot;HeadsUpDisplay&quot;</param>
                                    <param id="2" name="X">LayoutWidth/2</param>
                                    <param id="3" name="Y">LayoutHeight/2</param>
                                </action>
                                <action id="-7" name="Set size" type="TransparentBackground">
                                    <param id="0" name="Width">LayoutWidth</param>
                                    <param id="1" name="Height">LayoutHeight</param>
                                </action>
                                <action id="-4" name="Set position to another object" type="MenuScreen">
                                    <param id="0" name="Object">TransparentBackground</param>
                                    <param id="1" name="Image point (optional)">0</param>
                                </action>
                                <action id="-24" name="Move to top" type="MenuScreen" />
                                <action id="0" name="Spawn another object" type="MenuScreen">
                                    <param id="0" name="Object">Button</param>
                                    <param id="1" name="Layer">&quot;HeadsUpDisplay&quot;</param>
                                    <param id="2" name="Image point">&quot;MenuButton&quot;</param>
                                </action>
                                <action id="5" name="Set frame" type="Button">
                                    <param id="0" name="Frame number">2</param>
                                </action>
                                <action id="0" name="Spawn another object" type="MenuScreen">
                                    <param id="0" name="Object">Button</param>
                                    <param id="1" name="Layer">&quot;HeadsUpDisplay&quot;</param>
                                    <param id="2" name="Image point">&quot;NextButton&quot;</param>
                                </action>
                                <action id="5" name="Set frame" type="Button">
                                    <param id="0" name="Frame number">3</param>
                                </action>
                                <action id="0" name="Spawn another object" type="MenuScreen">
                                    <param id="0" name="Object">Button</param>
                                    <param id="1" name="Layer">&quot;HeadsUpDisplay&quot;</param>
                                    <param id="2" name="Image point">&quot;RetryButton&quot;</param>
                                </action>
                                <action id="5" name="Set frame" type="Button">
                                    <param id="0" name="Frame number">4</param>
                                </action>
                            </actions>
                        </event-block>
                    </sub-events>
                </event-block>
            </sub-events>
        </event-group>
        <event-group description="" title="Handle Menu Screen buttons">
            <sub-events>
                <event-block>
                    <conditions>
                        <condition id="3" name="On touched object" type="Touch">
                            <param id="0" name="Object">Button</param>
                        </condition>
                    </conditions>
                    <actions>
                        <action behavior="Sine" id="0" name="Set active" type="Button">
                            <param id="0" name="State">1</param>
                        </action>
                        <action id="-16" name="Wait" type="System">
                            <param id="0" name="Seconds">Button.sine.Period</param>
                        </action>
                        <action behavior="Sine" id="0" name="Set active" type="Button">
                            <param id="0" name="State">0</param>
                        </action>
                    </actions>
                    <sub-events>
                        <comment>Handle Menu button by taking user to the Level select screen</comment>
                        <event-block>
                            <conditions>
                                <condition id="3" name="Compare frame" type="Button">
                                    <param id="0" name="Comparison">0</param>
                                    <param id="1" name="Number">2</param>
                                </condition>
                            </conditions>
                            <actions>
                                <action id="-25" name="Go to layout (by name)" type="System">
                                    <param id="0" name="Layout">&quot;LayoutLevelSelect&quot;</param>
                                </action>
                            </actions>
                        </event-block>
                        <comment>Handle the next button to take the user to the next level screen</comment>
                        <event-block>
                            <conditions>
                                <condition id="3" name="Compare frame" type="Button">
                                    <param id="0" name="Comparison">0</param>
                                    <param id="1" name="Number">3</param>
                                </condition>
                            </conditions>
                            <actions>
                                <action id="-10" name="Add to" type="System">
                                    <param id="0" name="Variable">gCurrentLevel</param>
                                    <param id="1" name="Value">1</param>
                                </action>
                                <action id="-25" name="Go to layout (by name)" type="System">
                                    <param id="0" name="Layout">&quot;LayoutLevel&quot; &amp; gCurrentLevel</param>
                                </action>
                            </actions>
                        </event-block>
                        <comment>Handle the retry button to reload the layout</comment>
                        <event-block>
                            <conditions>
                                <condition id="3" name="Compare frame" type="Button">
                                    <param id="0" name="Comparison">0</param>
                                    <param id="1" name="Number">4</param>
                                </condition>
                            </conditions>
                            <actions>
                                <action id="-26" name="Restart layout" type="System" />
                            </actions>
                        </event-block>
                    </sub-events>
                </event-block>
            </sub-events>
        </event-group>
    </events>
</c2eventsheet>
